﻿namespace DemoService
{
    using System;
    using System.ComponentModel.Composition;
    using System.Diagnostics.Contracts;

    /// <summary>
    /// Class executed from a MEF composed ServiceHost / factory.
    /// </summary>
    [Export]
    public sealed class ComposingService : IComposedService
    {
        #region Fields

        [Import( typeof( IReversinator ) )]
        private IReversinator reversinator;

        #endregion

        #region IComposedService Members

        /// <summary>
        /// Method to call in order to get your string reversed.
        /// </summary>
        /// <param name="input">Your String.</param>
        /// <returns>Your String Reversed.</returns>
        public String Reverser( String input )
        {
            Contract.Ensures( this.reversinator != null );

            return this.reversinator.Reversinate( input );
        }

        #endregion
    }
}
